package com.xiaoma.base.extend;

public enum HandlerEnum {

    TEXT("text",TextHandler.class),
    IMAGE("image", ImageHandler.class);
	
    String name;


    Class<? extends AbstractHandler> handler;


	private HandlerEnum(String name, Class<? extends AbstractHandler> handler) {
		this.name = name;
		this.handler = handler;
	}

    public static HandlerEnum getHandlerEnum(String type) {
    	type=type.toUpperCase();
        for (HandlerEnum msgType : HandlerEnum.values()) {
            if (msgType.name().equals(type)) {
                return msgType;
            }
        }
        
        return null;
    }
    

	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public Class<? extends AbstractHandler> getHandler() {
		return handler;
	}


	public void setHandler(Class<? extends AbstractHandler> handler) {
		this.handler = handler;
	}


    
}
